//
// Created by Martin on 2021/9/30.
//

#include "Proxy.h"

Proxy::Proxy()
{
}

Proxy::~Proxy()
{
    delete subject;
}

/**
 * 代理类可以延迟实例化实体类, 在需要的时候才实例化实体对象
 */
void Proxy::request()
{
    if (!subject)
        subject = new RealSubject();
    subject->request();
}
